cmake_minimum_required(VERSION 3.10)

project(gles)

set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

aux_source_directory(common SRC_LIST_COMMON)
aux_source_directory(src SRC_LIST_SRC)

include_directories(common)
include_directories(/usr/include)
include_directories(/usr/include/libdrm)
include_directories(/usr/include/GLES2)
include_directories(/usr/include/EGL)

# 查找 OpenGL 包
set(OPENGL_LIBRARIES /usr/lib/x86_64-linux-gnu/libGLESv2.so)
set(EGL_LIBRARIES /usr/lib/x86_64-linux-gnu/libEGL.so)
set(DRM_LIBRARIES /usr/lib/x86_64-linux-gnu/libdrm.so)
set(GBM_LIBRARIES /usr/lib/x86_64-linux-gnu/libgbm.so)

set(X11_LIBRARIES /usr/lib/x86_64-linux-gnu/libX11.so)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
	
find_package(Threads REQUIRED)

add_executable(main ${SRC_LIST_COMMON} ${SRC_LIST_SRC})

# 链接 OpenGL 库
target_link_libraries(main PRIVATE ${OPENGL_LIBRARIES} ${EGL_LIBRARIES} ${DRM_LIBRARIES} ${GBM_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) 

